//引入http组件
let http =require('http');

//创建服务器
http.createServer((req,res)=>{
    
    //解决中午乱码
    res.setHeader('Content-Type','text/html;charset=utf-8');

    if(req.url=='/' || req.ulr=='/index'){
        res.end('<h2>首页</h2>');
    }else if(req.url=='/login' ){
        res.end('<h2>登录页面</h2>');
    }else if(req.url=='/reg' ){
        res.end('<h2>注册页面</h2>');
    }else if(req.url=='/user'){
        res.end('<h2>用户中心</h2>');
    }else{
        res.end('404');
    }
    //链式端口绑定
}).listen(80,'www.abc123.com',()=>{
    console.log('浏览器打开www.abc123.com');
});